package JavaCollection.mapLearn;



import org.junit.jupiter.api.Test;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

/**
 * @author Lenl
 * @version v1.0
 * @create 2021-06-05 15:05
 * @description
 *
 * Properties:常用来处理配置文件。key和value都是String类型
 *
 *
 */
public class PropertiesTest {

    public static void main(String[] args) {
        try{
            test1();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

    @Test
    public static void test1() throws IOException {
        Properties pro=new Properties();
        FileInputStream fis=new FileInputStream("jdbc.properties");
        pro.load(fis);//加载流对应的文件

        fis.close();

        String name=pro.getProperty("name");
        String pwd=pro.getProperty("password");


        System.out.println(name+":"+pwd);

    }
}
